import axios from "axios";
import config from "@/config";
import {ElMessage} from "element-plus";

export function preFun(url,data){
    return new Promise((suc,err)=>{
        axios.post(config.url+url,data,{
            headers:{
                Authorization:localStorage.getItem("token")
            }
        }).then(d=>{
            suc(d);
        }).catch(d=>{
            ElMessage({
                type:"error",
                message:"网络连接失败！"
            })
        })
    })

}